function checkIsInBrowserClient()
{
    var d = window.location.hostname;
    if (d.indexOf("witcare") > -1) {
        //alert("http://xinl.witcare.com");
        if (typeof WTCBJF_CheckClient == "undefined") {
            openUrl("/Desktop/exc");
        } else {
            var ret = window.WTCBJF_CheckClient();
            if (parseInt(ret) < 21) {
                openUrl("/Desktop/exc");
            }
        }
    }
}

function getServerUrl()
{
    
    return "http://suyuan.chinaphper.com:8699";
}
//设置、获取用户UID
function getUserId() {
    return getCookie("wms.userid");
}
function setUserId(uid) {
    setCookie("wms.userid", uid);
}
//设置、获取用户角色
function getUserRole() {
    return getCookie("wms.userrole");
}
function setUserRole(rid) {
    setCookie("wms.userrole", rid);
}
//设置、获取用户Token
function getToken() {
    return getCookie("wms.token");
}
function setToken(token) {
    setCookie("wms.token", token);
}
//设置、获取用户身份
function getIdentity() {
    return getCookie("wms.identity");
}
function setIdentity(identity) {
    setCookie("wms.identity", identity);
}
//设置、获取代理
function getProxyAid() {
    return getCookie("wms.proxyaid");
}
function setProxyAid(aid) {
    setCookie("wms.proxyaid", aid);
}
//设置、获取代理商名称
function getProxyName() {
    return getCookie("wms.proxyname");
}
function setProxyName(name) {
    setCookie("wms.proxyname", name);
}
//设置、获取代理根ID
function getProxyPid() {
    return getCookie("wms.proxypid");
}
function setProxyPid(pid) {
    setCookie("wms.proxypid", pid);
}

//设置、获取代理根ID
function getProxyRootAid() {
    return getCookie("wms.proxyroot_id");
}
function setProxyRootAid(rid) {
    setCookie("wms.proxyroot_id", rid);
}
//设置、获取代理商名称
function getCompanyName() {
    return getCookie("wms.companyname");
}
function setCompanyName(name) {
    setCookie("wms.companyname", name);
}
//设置、获取企业
function getUserCid() {
    return getCookie("wms.usercid");
}
function setUserCid(cid) {
    setCookie("wms.usercid", cid);
}

//设置、获取网点
function getUserBid() {
    return getCookie("wms.userbid");
}
function setUserBid(bid) {
    setCookie("wms.userbid", bid);
}
//设置、获取网点BID
function getBranchId() {
    return getCookie("wms.branchbid");
}
function setBranchId(bid) {
    setCookie("wms.branchbid", bid);
}
function getUserAbbr() {
    return getCookie("wms.userabbr");
}
function setUserAbbr(abbr) {
    setCookie("wms.userabbr", abbr);
}

//企业id
function getFirmId() {
    return getCookie("wms.firmid");
}
function setFirmId(id) {
    setCookie("wms.firmid", id);
}
function setCodePrefix(code_prefix) {
    setCookie("wms.code_prefix", code_prefix);
}

function getCodePrefix() {
    if (empty(getCookie("wms.code_prefix"))) {
        return "810008";
    } else {
        return getCookie("wms.code_prefix");
    }
}
/**
 * 显示分页函数
 * @param total
 * @param page
 * @param element
 */
function showpage(total,page,page_size,url){
    var pages = Math.ceil(total/page_size);//这里data里面有数据总量
    //alert(page);
    var options = {
        bootstrapMajorVersion:3,
        currentPage: page,//当前页面
        numberOfPages: 5,//一页显示几个按钮（在ul里面生成5个li）
        totalPages:pages, //总页数
        pageUrl:function(type, page, current) {
            return url+"?"+ "page_no=" + page;
        }
    }
}
/**
*实现2(返回 $_GET 对象, 仿PHP模式)
*/
var $_GET = (function(){
    var url = window.document.location.href.toString();
    var u = url.split("?");
    if(typeof(u[1]) == "string"){
        u = u[1].split("&");
        var get = {};
        for(var i in u){
            var j = u[i].split("=");
            get[j[0]] = j[1];
        }
        return get;
    } else {
        return {};
    }
})();

function getwindowhref(){
    var url = window.location.href;
    var url = url.split('?');
    var url = url[0];
    return url;
}
function getPageNo(){
    var page_no = 1 ;
    if($_GET['page_no']){
        page_no =$_GET['page_no'];
    }
    return page_no;
}

